// 论坛相关类型定义

export interface Category {
  id: number
  name: string
  description?: string
  icon?: string
  postCount: number
  createdAt: string
  updatedAt: string
}

export interface Post {
  id: number
  title: string
  content: string
  categoryId: number
  categoryName?: string
  userId: number
  username: string
  avatar?: string
  user?: {
    id: number
    username: string
    avatar?: string
    email?: string
  }
  viewCount: number
  likeCount: number
  commentCount: number
  tags?: string[]
  status: 'APPROVED' | 'PENDING' | 'REJECTED'
  isTop?: boolean
  isHot?: boolean
  isLiked?: boolean
  isFollowed?: boolean
  isCollected?: boolean
  summary?: string
  author?: {
    id: number
    username: string
    avatar?: string
  }
  category?: {
    id: number
    name: string
  }
  createdAt: string
  updatedAt: string
  comments?: Comment[]
}

export interface Comment {
  id: number
  postId: number
  content: string
  userId: number
  username: string
  avatar?: string
  parentId?: number
  likeCount: number
  isLiked?: boolean
  createdAt: string
  updatedAt: string
  replies?: Comment[]
}

export interface PostPagination {
  currentPage: number
  total: number
  pageSize: number
  items: Post[]
  data?: Post[]
  // Spring Boot Page 对象格式支持
  content?: Post[]
  totalElements?: number
  totalPages?: number
  size?: number
  number?: number
  first?: boolean
  last?: boolean
}

export interface CommentPagination {
  currentPage: number
  total: number
  pageSize: number
  items: Comment[]
}

export interface CreatePostData {
  title: string
  content: string
  categoryId: number
  tags?: string[]
}

export interface CreateCommentData {
  postId: number
  content: string
  parentId?: number
}